#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:demo04.py
@time:2022/07/27
"""
from flask import  Flask,Response,request
import json

app = Flask(__name__)

@app.route("/persons")
def router():
    ...
    persons = [
        {
            'name':'张三',
            'age':21
        },
        {
            'name': '李四',
            'age': 22
        },
        {
            'name': '王武',
            'age': 25
        },
    ]

    host = request.headers.get("host")
    print(host)

    return Response(json.dumps(persons), mimetype="application/json")



if __name__ == '__main__':
    pass
    app.run()